package com.xiaoyilin;

import com.xiaoyilin.service.impl.GrpcServiceImpl;
import io.grpc.Server;
import io.grpc.ServerBuilder;

/**
 * @author Administrator
 */
public class GpcServerApplication {

    public static void main(String[] args) throws Exception {
        Server server = ServerBuilder.forPort(8082)
                .addService(new GrpcServiceImpl())
                .build().start();
        server.awaitTermination();
        Runtime.getRuntime().addShutdownHook(new Thread(() -> {
            System.out.println("*** shutting down gRPC server since JVM is shutting down");
            server.shutdown();
        }));
    }


}
